"""
@title(TenX腾晓2024年11月考核答题文件)
@warning(请勿修改参数和返回值)
@warning(请认真填写__init__中的数据)
@author(1323230180)
"""


class TenXClass:
    def __init__(self):
        self.name = "黄善博"
        self.id = "3124002008"

    @staticmethod
    def question1(n: int) -> list[str]:
        lis = []
        for i in range(1, n + 1):
            b = ""
            while i > 0:
                q = i % 4
                b = str(q) + b
                i = i // 4
            lis.append(b)

        print(lis)# 打印，防止IDE警告
        return lis

    @staticmethod
    def question2() -> tuple[int, int, int]:
        lis=[]
        for x in range(101):
            for y in range(101):
                for z in range(101):
                    if x + y + z == 100 and (5 * x) + (3 * y) + (z // 3) == 100 and z % 3 == 0:
                            list = (x, y, z)
                            lis.append(list)
                            print(lis)
        return lis

    @staticmethod
    def question3(equipment: list[str], prop: list[str], material: list[str], items: list[str]) -> dict[str, list[str]]:

        equipment1 = []
        prop1 = []
        material1 = []
        q = {}

        for i in items:
            if i in equipment:
                equipment1.append(i)
            elif i in prop:
                prop1.append(i)
            elif i in material:
                material1.append(i)
        q = {"equipment": equipment1, "prop": prop1, "material": material1}
        print(equipment, prop, material, items)  # 打印，防止IDE警告
        return q

    @staticmethod
    def question4(item_values: dict[str, int], items: list[str]) -> tuple[list[str], int]:
        item_count = {}
        for i in items:
            if i in item_values:
                item_count[i] = item_count.get(i, 0) + 1
        s = sorted(item_count.keys(), key=lambda x: item_values[x], reverse=True)
        p = []
        t_v = 0
        for i in s:
            if len(p) < 3:
                p.extend([i] * min(item_count[i], 3 - len(p)))
        for k in p:
                t_v += item_values[k]
        a = (p, t_v)
        print(item_values, items)  # 打印，防止IDE警告
        return a

    @staticmethod
    def question5(matrix: list[list[int]]) -> list[tuple[int, int]]:
        lis = []
        x = 0
        y = 0
        for i in matrix:
            x += 1
            for a in i:
                y += 1
                if a == 0:
                    r = (x, y)
                    lis.append(r)
            y = 0

        print(matrix)  # 打印，防止IDE警告
        return lis